<?php
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

require DISCUZ_ROOT.'./source/function/function_mail.php';
require DISCUZ_ROOT.'./source/function/function_date.php';

$id =  $_G['gp_id'];
if ($id > 0) {
	$data = array();
	$nick_name =  $_G['gp_nick_name'];
	if (!empty($nick_name)) { $data['nick_name'] = $nick_name; }
	$birthyear = $_G['gp_birthyear'];
	if (!empty($birthyear)) { $data['birthyear'] = $birthyear; }
	$birthmonth = $_G['gp_birthmonth'];
	if (!empty($birthmonth)) { $data['birthmonth'] = $birthmonth; }
	$birthday = $_G['gp_birthday'];
	if (!empty($birthday)) { $data['birthday'] = $birthday; }
	$prepare_pregnancy = empty($_G['gp_prepare_pregnancy']) ? 0 : 1;
	if (!empty($prepare_pregnancy)) { $data['prepare_pregnancy'] = $prepare_pregnancy; }
	$data['email_confirmed'] = 1;
	$data['unsubscribe'] = 0;
	$data['unsubscribe_time'] = 0;

	$row_count = DB::update('article_subscribe', $data, array('id' => $id));
	if ($row_count > 0) {
		showmessage(lang('know/template', 'resubscribe_verify_success'));
	}
	else {
		showmessage(lang('know/template', 'resubscribe_verify_fail'));
	}
}
else {
	showmessage(lang('know/template', 'resubscribe_id_empty'));
}
?>